package com.example.common.vo.cart;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author zyred
 * @since v 0.1
 **/
@Slf4j
@Setter
@Getter
public class CartItemVo {

    private Long skuId;

    private String title;

    private boolean check = true;

    private String image;

    private List<String> skuAttr;

    private BigDecimal price;

    private Integer count;

    private BigDecimal totalPrice;

    private boolean hasStock;

    private BigDecimal weight = BigDecimal.valueOf(0.0);

    public BigDecimal getTotalPrice () {
        // 计算购物项总价
        log.info("价格：{}", this.price);
        return this.price.multiply(BigDecimal.valueOf(this.count));
    }

}
